--DO NOT MODIFY THIS FILE. IT IS ALWAYS OVERWRITTEN ON GENERATION.
--Audit Triggers For Version 0.0.0.0
--Generated on 2010-07-19 10:22:11

--DROP ANY AUDIT TRIGGERS FOR [CUSTOMER]
if exists(select * from sysobjects where name = '__TR_CUSTOMER__INSERT' AND xtype = 'TR')
DROP TRIGGER [__TR_CUSTOMER__INSERT]
GO
if exists(select * from sysobjects where name = '__TR_CUSTOMER__UPDATE' AND xtype = 'TR')
DROP TRIGGER [__TR_CUSTOMER__UPDATE]
GO
if exists(select * from sysobjects where name = '__TR_CUSTOMER__DELETE' AND xtype = 'TR')
DROP TRIGGER [__TR_CUSTOMER__DELETE]
GO

--CREATE TRIGGER INSERT FOR [CUSTOMER]
CREATE TRIGGER [__TR_CUSTOMER__INSERT]
ON [CUSTOMER]
FOR INSERT AS
INSERT INTO [__AUDIT__CUSTOMER] ([__action],[code],[company_name],[title],[user_id],[modified_by],[__insertdate])
SELECT 1, [code],[company_name],[title],[user_id],[modified_by],getdate() FROM [inserted]
GO

--CREATE TRIGGER UPDATE FOR [CUSTOMER]
CREATE TRIGGER [__TR_CUSTOMER__UPDATE]
ON [CUSTOMER]
FOR UPDATE AS
INSERT INTO [__AUDIT__CUSTOMER] ([__action],[code],[company_name],[title],[user_id],[modified_by],[__insertdate])
SELECT 2, [code],[company_name],[title],[user_id],[modified_by],getdate() FROM [inserted]
GO

--CREATE TRIGGER DELETE FOR [CUSTOMER]
CREATE TRIGGER [__TR_CUSTOMER__DELETE]
ON [CUSTOMER]
FOR DELETE AS
INSERT INTO [__AUDIT__CUSTOMER] ([__action],[code],[company_name],[title],[user_id],[modified_by],[__insertdate])
SELECT 3, [code],[company_name],[title],[user_id],[modified_by],getdate() FROM [deleted]
GO

--DROP ANY AUDIT TRIGGERS FOR [EMPLOYEE]
if exists(select * from sysobjects where name = '__TR_EMPLOYEE__INSERT' AND xtype = 'TR')
DROP TRIGGER [__TR_EMPLOYEE__INSERT]
GO
if exists(select * from sysobjects where name = '__TR_EMPLOYEE__UPDATE' AND xtype = 'TR')
DROP TRIGGER [__TR_EMPLOYEE__UPDATE]
GO
if exists(select * from sysobjects where name = '__TR_EMPLOYEE__DELETE' AND xtype = 'TR')
DROP TRIGGER [__TR_EMPLOYEE__DELETE]
GO

--DROP ANY AUDIT TRIGGERS FOR [EMPLOYEE_TERRITORY]
if exists(select * from sysobjects where name = '__TR_EMPLOYEE_TERRITORY__INSERT' AND xtype = 'TR')
DROP TRIGGER [__TR_EMPLOYEE_TERRITORY__INSERT]
GO
if exists(select * from sysobjects where name = '__TR_EMPLOYEE_TERRITORY__UPDATE' AND xtype = 'TR')
DROP TRIGGER [__TR_EMPLOYEE_TERRITORY__UPDATE]
GO
if exists(select * from sysobjects where name = '__TR_EMPLOYEE_TERRITORY__DELETE' AND xtype = 'TR')
DROP TRIGGER [__TR_EMPLOYEE_TERRITORY__DELETE]
GO

--DROP ANY AUDIT TRIGGERS FOR [EMPLOYEE_TYPE]
if exists(select * from sysobjects where name = '__TR_EMPLOYEE_TYPE__INSERT' AND xtype = 'TR')
DROP TRIGGER [__TR_EMPLOYEE_TYPE__INSERT]
GO
if exists(select * from sysobjects where name = '__TR_EMPLOYEE_TYPE__UPDATE' AND xtype = 'TR')
DROP TRIGGER [__TR_EMPLOYEE_TYPE__UPDATE]
GO
if exists(select * from sysobjects where name = '__TR_EMPLOYEE_TYPE__DELETE' AND xtype = 'TR')
DROP TRIGGER [__TR_EMPLOYEE_TYPE__DELETE]
GO

--DROP ANY AUDIT TRIGGERS FOR [REGION]
if exists(select * from sysobjects where name = '__TR_REGION__INSERT' AND xtype = 'TR')
DROP TRIGGER [__TR_REGION__INSERT]
GO
if exists(select * from sysobjects where name = '__TR_REGION__UPDATE' AND xtype = 'TR')
DROP TRIGGER [__TR_REGION__UPDATE]
GO
if exists(select * from sysobjects where name = '__TR_REGION__DELETE' AND xtype = 'TR')
DROP TRIGGER [__TR_REGION__DELETE]
GO

--DROP ANY AUDIT TRIGGERS FOR [SYSTEM_USER]
if exists(select * from sysobjects where name = '__TR_SYSTEM_USER__INSERT' AND xtype = 'TR')
DROP TRIGGER [__TR_SYSTEM_USER__INSERT]
GO
if exists(select * from sysobjects where name = '__TR_SYSTEM_USER__UPDATE' AND xtype = 'TR')
DROP TRIGGER [__TR_SYSTEM_USER__UPDATE]
GO
if exists(select * from sysobjects where name = '__TR_SYSTEM_USER__DELETE' AND xtype = 'TR')
DROP TRIGGER [__TR_SYSTEM_USER__DELETE]
GO

--DROP ANY AUDIT TRIGGERS FOR [TERRITORY]
if exists(select * from sysobjects where name = '__TR_TERRITORY__INSERT' AND xtype = 'TR')
DROP TRIGGER [__TR_TERRITORY__INSERT]
GO
if exists(select * from sysobjects where name = '__TR_TERRITORY__UPDATE' AND xtype = 'TR')
DROP TRIGGER [__TR_TERRITORY__UPDATE]
GO
if exists(select * from sysobjects where name = '__TR_TERRITORY__DELETE' AND xtype = 'TR')
DROP TRIGGER [__TR_TERRITORY__DELETE]
GO

